<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePointsProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('points_products', function (Blueprint $table) {
            $table->id();
            $table->string('title')->nullable();
            $table->unsignedInteger('coupon_id');
            $table->unsignedInteger('product_id');
            $table->string('image')->nullable()->comment('图片');
            $table->decimal('price', 10, 2)->comment('原价');
            $table->integer('stock')->default(0)->comment('库存');
            $table->integer('quantity')->default(0)->comment('每人可兑换数量');
            $table->integer('points')->default(0)->comment('消耗积分');
            $table->text('desc')->nullable()->comment('商品描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('points_products');
    }
}
